<?php
$page = (intval($this->uri->segment(4)));
if ($page <= 1)
    $page = 0;
else
    $page = ($page - 1) * PAGE_SIZE
    ?>
<?= anchor($uri = 'admincp/admin_product/add_product', $title = 'Thêm sản phẩm mới', $attributes = array('class' => 'add')) ?>
<div style="float:left; width: 100%">
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
        <tbody>
            <tr >

                <th class="table-header-repeat line-left minwidth-1" ><a >#</a>	</th>
                <th class="table-header-repeat line-left minwidth-1"><a >Hình ảnh</a></th>
                <th class="table-header-repeat line-left"><a >Tên sản phẩm</a></th>
                <th class="table-header-repeat line-left"><a >Giá công ty</a></th>
                <th class="table-header-repeat line-left"><a >Giá tấn phát</a></th>
                <th class="table-header-repeat line-left"><a >Bảo hành</a></th>
                <th class="table-header-repeat line-left"><a >Ngày thêm</a></th>
                <th class="table-header-repeat line-left"><a >Cho phép hiển thị</a></th>
                <th class="table-header-repeat line-left"><a > SP mới</a></th>
                <th class="table-header-repeat line-left"><a >SP cũ</a></th>
                <th class="table-header-repeat line-left"><a >Lượt xem</a></th>
                <th class="table-header-repeat line-left"><a >Điểm</a></th>
                <th class="table-header-repeat line-left"><a >Danh mục</a></th>
                <th class="table-header-options line-left"><a >Thao tác</a></th>
            </tr>
            <?php //if (isset($list)) { ?>

            <?php
            $i = 0;
            foreach ($list as $row):
                ?>

                <tr  style="text-transform: uppercase" <?= ($i % 2) ? 'class="alternate-row"' : '' ?>  >

                    <td><?= $i+$page+1 ?></td>
                    <td><a href="<?= HOME_PAGE . ADMIN_PAGE ?>admin_product/update_product/<?= $row->product_id ?>"><img src="<?= FRONT_UPLOADED.$row->image_url ?>" width="70" height="70"/></a></td>
                    <td><a href="<?= HOME_PAGE . ADMIN_PAGE ?>admin_product/update_product/<?= $row->product_id ?>"><?= $row->product_name ?></a></td>
                    <td><?= number_format($row->product_company_price)?> VNĐ</td>
                    <td><?= number_format($row->product_tan_phat_price)?> VNĐ</td>
                    <td><?= $row->product_guarantee_time?></td>
                    <td><?= $row->product_date ?></td>
                    <td><?= $row->product_is_display==1?"Có":"Không" ?></td>
                    <td><?=$row->product_is_new==1?"Có":"Không"?></td>
                    <td><?=$row->product_is_old==1?"Có":"Không" ?></td>
                    <td><?=$row->product_viewer?></td>
                    <td><?=$row->product_rate?></td>
                    <td><?=$row->category_name?></td>
                    <td class="options-width">
                        <a href="<?= HOME_PAGE . ADMIN_PAGE ?>admin_product/update_product/<?= $row->product_id ?>" class="icon-1 info-tooltip" title="Cập nhật"></a>
                        <a href="<?= HOME_PAGE . ADMIN_PAGE ?>admin_product/delete_product/<?= $row->product_id ?>" onclick="return confirm('Bạn muốn xóa?');" class="icon-2 info-tooltip" title="Xóa"></a>
                        <a href="<?= HOME_PAGE . ADMIN_PAGE ?>admin_product/add_images/<?= $row->product_id ?>" class="icon-3 info-tooltip" title="Thêm ảnh"></a>
                    </td>
                </tr>
                <?php
                $i++;
            endforeach;
            ?>

            <?php // } ?>

        </tbody></table>
    <!--  end product-table................................... --> 

    <table border="0" cellpadding="0" cellspacing="0" >
        <tbody><tr>
                <td>
                    <div class="paging">
                        <?= $this->pagination->create_links(); ?>
                    </div>
                </td>

            </tr>
        </tbody></table>
</div>